package com.qtenv.datasync.api.huizhong;

import com.alibaba.fastjson.JSON;
import org.apache.axis.client.Service;

import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.ServiceException;
import java.rmi.RemoteException;

/**
 * @ClassName HZTest
 * @Author CBL
 * @Date 2022/2/23 16:41
 **/
public class HZTest {
    public static void main(String[] args) throws ServiceException, RemoteException {
        GetMethodsServiceLocator gsl = new GetMethodsServiceLocator();
//        String result = gsl.getGetMethods().getUserData("4048835736929280");
//        System.out.println(CustomGet("4664270528037888"));
        String result = gsl.getGetMethods().getHistoryData("4048835736929280", "1261180300079", "2023-12-13 00:00:00",
                "2023-12-13 23:59:59", "1", "300");
        System.out.println(JSON.toJSON(result));
    }

    public static String CustomGet(String input) {
        String address = "http://222.222.194.114:8909/huizhong/services/GetMethods?wsdl";
        String action = "getUserData";
        Service service = new Service();
        try {
            Call call = service.createCall();
            call.setTargetEndpointAddress(address);
            call.setOperationName(QName.valueOf(action));
            String result = (String) call.invoke(new Object[]{input});
            return result;
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (ServiceException e) {
            e.printStackTrace();
        }

        return null;
    }
}
